package com.sansecy.video.player;

import android.net.Uri;
import android.view.Surface;

public interface IPlayer {
    public static final int UNSUPPORTED_VIDEO_TRACKS = 1;
    public static final int UNSUPPORTED_AUDIO_TRACKS = 2;
    public static final int UNSUPPORTED_TEXT_TRACKS = 3;

    void setUri(Uri uri);

    void setUri(Uri uri, String url);

    void setVolume(float volume);

    long getDuration();

    long getCurrentPosition();

    void seekTo(long position);

    boolean isPlaying();

    void start();

    void pause();

    void stop();

    void release();

    void setDisplay(Surface surface);

    void prepareAsync();

    void setOnVideSizeChangeListener(OnVideoSizeChangedListener onVideoSizeChangedListener);

    void setOnBufferListener(OnBufferListener onBufferListener);

    void setOnCompletionListener(OnCompletionListener onCompletionListener);

    int getBufferPercentage();

    void setSubtitle(String uri, String mimeType);

    Object getPlayer();

    IPlayer getIPlayer();

    boolean isAudio();

    void setOnErrorListener(onErrorListener onErrorListener);

    interface onErrorListener {
        void onError(int unsupportedTracksType);
    }

    interface OnCompletionListener {
        /**
         * Called when the end of a media source is reached during playback.
         *
         * @param mp the MediaPlayer that reached the end of the file
         */
        void onCompletion();
    }

    interface OnVideoSizeChangedListener {
        void onVideoSizeChanged(int width, int height);
    }

    interface OnBufferListener {
        void onBufferStart();

        void onBufferEnd();

        void onBufferUpdate(int percent);
    }
}
